﻿using System;
using SceneAssist;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

namespace Studio
{
	// Token: 0x02000561 RID: 1377
	public class GameSceneNode : PointerAction
	{
		// Token: 0x17000441 RID: 1089
		// (get) Token: 0x0600231A RID: 8986 RVA: 0x000D448C File Offset: 0x000D268C
		// (set) Token: 0x0600231B RID: 8987 RVA: 0x000D44B0 File Offset: 0x000D26B0
		public bool interactable
		{
			get
			{
				return this.button && this.button.interactable;
			}
			set
			{
				if (this.button)
				{
					this.button.interactable = value;
				}
				if (!value && this.imageCover)
				{
					this.imageCover.enabled = false;
				}
			}
		}

		// Token: 0x17000442 RID: 1090
		// (get) Token: 0x0600231C RID: 8988 RVA: 0x000D44F0 File Offset: 0x000D26F0
		// (set) Token: 0x0600231D RID: 8989 RVA: 0x000D4514 File Offset: 0x000D2714
		public bool select
		{
			get
			{
				return this.imageSelect && this.imageSelect.enabled;
			}
			set
			{
				if (this.imageSelect)
				{
					this.imageSelect.enabled = value;
				}
			}
		}

		// Token: 0x17000443 RID: 1091
		// (set) Token: 0x0600231E RID: 8990 RVA: 0x000D4534 File Offset: 0x000D2734
		public Sprite selectSprite
		{
			set
			{
				if (this.imageSelect)
				{
					this.imageSelect.sprite = value;
				}
			}
		}

		// Token: 0x17000444 RID: 1092
		// (get) Token: 0x0600231F RID: 8991 RVA: 0x000D4554 File Offset: 0x000D2754
		// (set) Token: 0x06002320 RID: 8992 RVA: 0x000D457C File Offset: 0x000D277C
		public string text
		{
			get
			{
				return (!this.content) ? string.Empty : this.content.text;
			}
			set
			{
				if (this.content)
				{
					this.content.text = value;
					this.content.enabled = false;
					this.content.enabled = true;
				}
			}
		}

		// Token: 0x06002321 RID: 8993 RVA: 0x000D45B4 File Offset: 0x000D27B4
		private void SetCoverEnabled(bool _enabled)
		{
			if (this.button && !this.button.interactable)
			{
				return;
			}
			if (this.imageCover)
			{
				this.imageCover.enabled = _enabled;
			}
		}

		// Token: 0x06002322 RID: 8994 RVA: 0x000D45F4 File Offset: 0x000D27F4
		private void PlaySelectSE()
		{
			if (this.button && !this.button.interactable)
			{
				return;
			}
		}

		// Token: 0x06002323 RID: 8995 RVA: 0x000D4618 File Offset: 0x000D2818
		public void AddActionToButton(UnityAction _action)
		{
			if (this.button)
			{
				this.button.onClick.AddListener(_action);
			}
		}

		// Token: 0x06002324 RID: 8996 RVA: 0x000D463C File Offset: 0x000D283C
		public void AddCoverDisabled()
		{
			if (this.button)
			{
				this.button.onClick.AddListener(delegate()
				{
					if (this.imageCover)
					{
						this.imageCover.enabled = false;
					}
				});
			}
		}

		// Token: 0x06002325 RID: 8997 RVA: 0x000D466C File Offset: 0x000D286C
		public void Destroy()
		{
			UnityEngine.Object.Destroy(base.gameObject);
		}

		// Token: 0x06002326 RID: 8998 RVA: 0x000D467C File Offset: 0x000D287C
		public void SetActive(bool _value)
		{
			base.gameObject.SetActive(_value);
		}

		// Token: 0x06002327 RID: 8999 RVA: 0x000D468C File Offset: 0x000D288C
		private void Awake()
		{
			this.listEnterAction.Add(delegate
			{
				this.SetCoverEnabled(true);
			});
			this.listEnterAction.Add(new UnityAction(this.PlaySelectSE));
			this.listExitAction.Add(delegate
			{
				this.SetCoverEnabled(false);
			});
			if (this.isAddCoverDisabled)
			{
				this.AddCoverDisabled();
			}
			GameSceneNode.ClickSound clickSound = this.clickSound;
			if (clickSound != GameSceneNode.ClickSound.OK)
			{
				if (clickSound == GameSceneNode.ClickSound.Cancel)
				{
					this.AddActionToButton(delegate
					{
						Assist.PlayCancelSE();
					});
				}
			}
			else
			{
				this.AddActionToButton(delegate
				{
					Assist.PlayDecisionSE();
				});
			}
		}

		// Token: 0x0400241A RID: 9242
		[SerializeField]
		private Button button;

		// Token: 0x0400241B RID: 9243
		[SerializeField]
		private Image imageCover;

		// Token: 0x0400241C RID: 9244
		[SerializeField]
		private Image imageSelect;

		// Token: 0x0400241D RID: 9245
		[SerializeField]
		private Text content;

		// Token: 0x0400241E RID: 9246
		[Tooltip("クリックされた時にかぶせを解除する")]
		[SerializeField]
		private bool isAddCoverDisabled;

		// Token: 0x0400241F RID: 9247
		[SerializeField]
		private GameSceneNode.ClickSound clickSound;

		// Token: 0x02000562 RID: 1378
		private enum ClickSound
		{
			// Token: 0x04002423 RID: 9251
			NoSound,
			// Token: 0x04002424 RID: 9252
			OK,
			// Token: 0x04002425 RID: 9253
			Cancel
		}
	}
}
